from PJKuGou import Public_kugo


class SearchKWMusic:

    def search(self, keyword, page, pagesize):
        cx = Public_kugo()
        total, search = cx.Search(keyword, page, pagesize)

        list = []

        for data in search:
            list.append({
                "id": data["AlbumID"],
                "gqm": data["SongName"],
                "gs": data["SingerName"],
                "hash": data["FileHash"],
            })

        return {
            "head": None,
            "list": list,
            "total": total
        }
